require 'rbconfig'

ASsources = Dir.glob("native/base/*.c") + Dir.glob("native/scenegraph/*.c")
BINDsources = Dir.glob("native/opengl/*.c") + Dir.glob("native/openal/*.c")
CPsources = Dir.glob("Chipmunk/src/*.c") + Dir.glob("Chipmunk/ruby/*.c")
MISCsources = Dir.glob("oggstreamer/*.c") + %w"main.c"

ALLsources = (ASsources + BINDsources + CPsources + MISCsources).join(" ")
#CPsources = CPsources.join(" ")

cflags = '-L/mingw/lib -lmingw32 -lSDLmain -lSDL -mwindows'
cflags += " -I#{Config::CONFIG['archdir']} -IChipmunk/src -IChipmunk/ruby -Inative/base -Ioggstreamer"

linkerflags = '-lglu32 -lopengl32 -lglut -lmsvcrt-ruby18 -L/mingw/lib -lmingw32 -lSDLmain -lSDL -lpng -ljpeg -lOpenAL32 -lvorbisfile -lvorbis -logg -lm'

  
#puts "#{cflags} #{linkerflags}"
puts "gcc -std=gnu99 #{cflags} #{ALLsources} #{linkerflags} -o Aerosol/aerosol.exe"
system "gcc -std=gnu99 #{cflags} #{ALLsources} #{linkerflags} -o Aerosol/aerosol.exe"
